// see http://vuejs-templates.github.io/webpack for documentation.
var path = require('path');
module.exports = {
  build: {
    env: require('./prod.env'),
    index: path.resolve(__dirname, '../dist/index.html'),
    assetsRoot: path.resolve(__dirname, '../dist'),
    assetsSubDirectory: 'static',
    assetsPublicPath: '/perform-zx-web',
    // assetsPublicPath: '/um-web',
    productionSourceMap: true,
    // Gzip off by default as many popular static hosts such as
    // Surge or Netlify already gzip all static assets for you.
    // Before setting to `true`, make sure to:
    // npm install --save-dev compression-webpack-plugin
    productionGzip: false,
    productionGzipExtensions: ['js', 'css']
  },
  dev: {
    env: require('./dev.env'),
    port: 3006,
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    proxyTable: {
      // 服务器代理
      '/api/um-service': {
        // target: 'http://10.5.9.182:8001/', // 直销
        // target: 'http://10.30.44.152:8089/',
        target: 'http://10.5.9.179:8001/', // 直销
        // target: 'http://10.5.9.175:8001/', // 直销 174
        // target: 'http://10.5.9.174:8089/', // 团险
        // target: 'http://10.5.9.174:8003/', // 大健康
        // target: 'http://10.5.9.175:8001/',
        // target: 'http://10.5.9.182:8001/',
        changeOrigin: true,
        pathRewrite: {
          '^/api/um-service': '/um-service'
        }
      },
      '/api/um-zx-service': {
        // target: 'http://10.30.44.152:8089/',
        // target: 'http://10.5.9.182:8001/', // 直销
        target: 'http://10.5.9.179:8001/', // 直销
        // target: 'http://10.5.9.175:8001/', // 直销 174
        // target: 'http://10.5.9.174:8089/', // 团险
        // target: 'http://10.5.9.174:8003/', // 大健康
        // target: 'http://10.5.9.175:8001/',
        changeOrigin: true,
        pathRewrite: {
          '^/api/um-zx-service': '/um-service'
        }
      },

      '/api/perform-zx-service': {
        target: 'http://10.5.9.178:8050/',
        // target: 'http://10.5.9.175:8050/', // 算薪考核测试地址
        // target: 'http://10.5.9.174:8050/',
        // target: 'http://10.5.9.183:8050/',
        changeOrigin: true,
        pathRewrite: {
          '^/api/perform-zx-service': '/perform-zx-service'
        }
      },
      '/api/perform-cw-service': {
        target: 'http://10.5.9.178:23255/', // 财务测试地址
        // target: 'http://10.5.9.175:8050/', // 算薪考核测试地址
        // target: 'http://10.5.9.174:8050/',
        // target: 'http://10.5.9.183:8050/',
        changeOrigin: true,
        pathRewrite: {
          '^/api/perform-cw-service': '/perform-cw-service'
        }
      },
			      // '/api/perform-service': {
      //   target: 'http://10.5.9.175:8050/',
      //   changeOrigin: true,
      //   pathRewrite: {
      //     '^/api/perform-service': '/perform-service'
      //   }
      // },
      // 直销
      '/api/img-service': {
        target: 'http://10.30.44.10:8018/',
        changeOrigin: true,
        pathRewrite: {
          '^/api/': '/'
        }
      },
      // 服务器代理
      '/api/knwldg-service': {
        target: 'http://10.30.44.10:8031/',
        changeOrigin: true,
        pathRewrite: {
          '^/api/knwldg-service': '/knwldg-service'
        }
      },
      '/thumb': {
        target: 'http://10.30.44.10:8888/',
        changeOrigin: true,
        pathRewrite: {
          '^/thumb/': '/'
        }
      },
      '/original': {
        target: 'http://10.30.44.10:8888/',
        changeOrigin: true,
        pathRewrite: {
          '^/original/': '/'
        }
      },
      // 消息服务代理
      '/api/msg-plat-service': {
        target: 'http://10.30.44.10:8019/',
        changeOrigin: true,
        pathRewrite: {
          '^/api/': '/'
        }
      },
      '/ws': {
        target: 'http://10.30.44.10:8019/',
        changeOrigin: true,
        ws: true,
        pathRewrite: {
          '^/ws': '/'
        }
      }
    },
    // CSS Sourcemaps off by default because relative paths are "buggy"
    // with this option, according to the CSS-Loader README
    // (https://github.com/webpack/css-loader#sourcemaps)
    // In our experience, they generally work as expected,
    // just be aware of this issue when enabling this option.
    cssSourceMap: false
  }
};
